proc saveconfig {} {
	global CONFIGFILE CONFIG
	set fp [open $CONFIGFILE w]
	puts $fp [array get CONFIG]
	close $fp
}

proc loadconfig {} {
	global CONFIGFILE CONFIG
	set fp [open $CONFIGFILE r]
	gets $fp var
	array set CONFIG $var
	close $fp

	# Check did we get the default language
	# If no, add it
	if {[info exists CONFIG(lang)] == 0} {
		set CONFIG(lang) "en"
	}

	saveconfig
}

proc createconfig {} {
	global CONFIGFILE
	set fp [open $CONFIGFILE w]
	puts $fp "defaultfont {Helvetica 10} widgetstyle default lang en nick {} ident {} realname {}"
	close $fp
}
